from model import Mysql
from peewee import *


class Log(Model):
    """
->   `id` int unsigned NOT NULL AUTO_INCREMENT,
    ->   `process_id` int unsigned NOT NULL,
    ->   `ip` varchar(50) NOT NULL,
    ->   `port` varchar(6) NOT NULL,
    ->   `project_id` int unsigned NOT NULL,
    ->   `project_name` varchar(50) NOT NULL,
    ->   `start_time` datetime NOT NULL,
    ->   `end_time` datetime NOT NULL,
    ->   PRIMARY KEY (`id`)
    -> ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3;
    """
    id = AutoField(primary_key=True, sequence=True)
    process_id = IntegerField(null=False)
    ip = CharField(null=False)
    port = CharField(null=False)
    project_id = IntegerField(null=False)
    project_name = CharField(null=False)
    start_time = DateTimeField(null=False)
    end_time = DateTimeField(null=False)

    class Meta:
        database = Mysql.db
